package mysql

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Account  string `gorm:"type:varchar(30);not null;comment:账号"`
	Password string `gorm:"type:varchar(32);not null;comment:密码"`
}

func (u *User) UserAdd(db *gorm.DB) error {
	return db.Debug().Create(u).Error
}

func (u *User) FindUserByAccount(db *gorm.DB, account string) error {
	return db.Debug().Where("account = ?", account).First(u).Error
}
